package com.study.tiger;

import java.util.HashSet;
import java.util.Set;

public class TwoColorBall {

    public int getRandomNum(int start,int end){
        int num  = (int)(Math.random()*end+start);
        return num;
    }

    public void twoColorBallToRead(){
        Set<Integer> set1 = new HashSet<>();
        Set<Integer> set2 = new HashSet<>();
        Set<Integer> set3 = new HashSet<>();
        Set<Integer> set = new HashSet<>();
        while((set1.size()+ set2.size()+set3.size())<6){
            int num  = getRandomNum(1,33);
            if(num<=10){
                if(set1.size()>=3){
                    continue;
                }
                set1.add(num);
            }else if(num>=30 && num <= 33){
                if(set2.size()>=2){
                    continue;
                }
                set2.add(num);
            }else{
                if(set3.size()>=4){
                    continue;
                }
                set3.add(num);
            }
        }
        set.addAll(set1);
        set.addAll(set2);
        set.addAll(set3);
        set.stream().sorted().forEach(item-> System.out.print(item+" "));
    }

    public void twoColorBallToBlue(){
        int num  = getRandomNum(1,16);
        System.out.println(num);
    }
}
